﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mathematics.Parser
{
    public class Token
    {
        internal Token(TokenType type,string text)
        {
            Type = type;
            Text = text;
        }

        public TokenType Type { get; private set;}
        public string Text { get; private set; }
        
        public bool IsAtom()
        {
            switch (Type)
            {
                case TokenType.FunctionCall:
                case TokenType.NumericConstant:
                case TokenType.VariableUsage:
                    return true;
                default:
                    return false;
            }
        }

        public bool IsAssignment()
        {
            switch (Type)
            {
                case TokenType.VariableAssignment:
                case TokenType.FunctionAssignment:
                    return true;
                default: return false;
            }
        }

        public bool IsExpression()
        {
            return Type == TokenType.Expression;
        }

        public override string ToString()
        {
            return string.Format("{0}: {1}", Type, Text);
        }
        
    }
}
